package com.heima.comment.controller.v1;

import com.heima.comment.service.ApArticleCommentRepayService;
import com.heima.model.comment.dtos.CommentRepayDto;
import com.heima.model.comment.dtos.CommentRepayLikeDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;

/**
 * @projectName: heima-leadnews-project_training
 * @author: Tyoui
 * @description: 文章评论回复业务控制层
 * @date: 2023/8/2 19:15
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class ArticleCommentRepayController {

    @Autowired
    private ApArticleCommentRepayService apArticleCommentRepayService;

    /**
     * @param dto:
     * @return ResponseResult
     * @description 保存回复评论
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody CommentRepaySaveDto dto) {
        return apArticleCommentRepayService.save(dto);
    }

    /**
     * @param dto:
     * @return ResponseResult
     * @description 加载回复评论列表
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDto dto) {
        return apArticleCommentRepayService.load(dto);
    }

    //评论回复点赞
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDto dto){
        return apArticleCommentRepayService.like(dto);
    }
}